package com.qf.first.pojo.vo;

import io.swagger.annotations.Api;
import lombok.Data;
import org.springframework.stereotype.Component;

@Component
@Data
@Api("返回值实体类")
public class RespVo <T>{
    //1、状态
    private int code = CodeType.SUCCESS.getValue();
    //2、状态说明
    private String msg;
    //3、数据
    private T data;
    public enum CodeType{
        //成功、失败、未登录
        SUCCESS(200),FAIL(100),UN_LOGIN(101);
        private int value;
        CodeType(int value){
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public T getData() {
        return data;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setData(T data) {
        this.data = data;
    }
}
